package com.get.backstage.common.log;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;


public class SuperfluousLogFilter extends Filter<ILoggingEvent> {

	@Override
	public FilterReply decide(ILoggingEvent event) {
		System.out.println("eventLoggerName:" + event.getLoggerName());
		if (getPackName(event.getLoggerName()).startsWith("com.get.backstage")) {
			return FilterReply.ACCEPT;
		} else {
			return FilterReply.DENY;
		}
	}

	public String getPackName(String className) {
		return className.substring(0, className.lastIndexOf("."));
	}
}